//
//  UILabel+UILabelAuTo.m
//  hxwjr
//
//  Created by qxy on 2017/3/3.
//  Copyright © 2017年 com.hxwjbank.ios. All rights reserved.
//

#import "UILabel+UILabelAuTo.h"

@implementation UILabel (UILabelAuTo)
- (CGSize)calculateSize:(NSString *)contentStr withFont:(UIFont *)font withWidth:(CGFloat)width{
    NSDictionary *atttibute = @{NSFontAttributeName:font};
    CGSize size = [contentStr boundingRectWithSize:CGSizeMake(width, MAXFLOAT) options:NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesLineFragmentOrigin attributes:atttibute context:nil].size;
    return size;
    
}
- (CGSize)calculateSize:(NSString *)contentStr withFont:(UIFont *)font withHeight:(CGFloat)Height{
    NSDictionary *atttibute = @{NSFontAttributeName:font};
    CGSize size = [contentStr boundingRectWithSize:CGSizeMake(MAXFLOAT,Height) options:NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesLineFragmentOrigin attributes:atttibute context:nil].size;
    return size;
    
}

@end
